package com.base.cn.platform.os.service.manage.order.goods;

import com.base.cn.platform.os.entity.order.order.ShopCart;
import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.manage.BaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 购物车接口
 *
 * @author s.li
 * @create 2018-06-15-11:29
 */
@FeignClient(name = BaseService.appName,configuration = FeignAuthConfig.class)
public interface ShopCartService extends BaseService {

    /**
     * 删除购物车
     * @param shopCartIds 购物ID串
     */
    @RequestMapping(contextPath + "/order/deleteShopCart")
    void deleteShopCart(@RequestParam("shopCartIds") String shopCartIds);

    /**
     * 修改购物车购买量
     * @param shopCartId 购物车ID
     * @param buyNum 购买量
     * @return
     */
    @RequestMapping(contextPath + "/order/updateShopCartNum")
    Map<String,Object> updateShopCartNum(@RequestParam("shopCartId") BigDecimal shopCartId,
                                         @RequestParam("buyNum") int buyNum);

    /**
     * 查询用户的购物车数据列表
     * @param userId 用户ID
     * @return List<ShopCart>
     */
    @RequestMapping(contextPath + "/order/findWebShowShopCartList")
    List<ShopCart> findWebShowShopCartList(@RequestParam("userId") BigDecimal userId);

    /**
     * 添加购物车
     * @param userId 用户ID
     * @param shopId 商品ID
     * @param shopType 商品类型
     * @param buyNum 购买量，默认1
     * @param shareKey 推广标识
     * @return
     */
    @RequestMapping(contextPath + "/order/addShopCart")
    Map<String,Object> addShopCart(@RequestParam("userId") BigDecimal userId,
                                   @RequestParam("shopId") BigDecimal shopId,
                                   @RequestParam("shopType") String shopType,
                                   @RequestParam(value = "buyNum", defaultValue = "1") int buyNum,
                                   @RequestParam(value = "shareKey", required = false) String shareKey);

    /**
     * 查询用户购物车商品数量
     * @param userId 用户id
     * @return 购物车中商品数量
     */
    @RequestMapping(contextPath + "/order/queryCartShopNum")
    Integer queryCartShopNum(@RequestParam("userId") BigDecimal userId);
}
